Skip to content

Conversation

danpoletaev
Copy link
Contributor

This PR adds new options to RunCollectionClient.list(): started_before and started_after.

Same PR in JS: apify/apify-client-js#763

@danpoletaev danpoletaev requested review from barjin and vdusek October 8, 2025 14:19
@danpoletaev danpoletaev self-assigned this Oct 8, 2025
@danpoletaev danpoletaev added the adhoc Ad-hoc unplanned task added during the sprint. label Oct 8, 2025
@github-actions github-actions bot added t-core-services Issues with this label are in the ownership of the core services team. tested Temporary label used only programatically for some analytics. labels Oct 8, 2025
offset=offset,
desc=desc,
status=status_param,
startedBefore=started_before,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure what is the best way to handle camelCase translation here?
We need to send it as startedBefore/startedAfter to API

Copy link
Contributor

@vdusek vdusek Oct 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do this for other parameters as well, so I believe it'll work 😄

(you can test it on a beta release, once this is merged)

Copy link
Contributor

@barjin barjin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That was fast! :) I'm not a Python dev, but the timezone handling IMO needs a bit more care here.

elif isinstance(value, list):
parsed_params[key] = ','.join(value)
elif isinstance(value, datetime):
utc_aware_dt = value.replace(tzinfo=timezone.utc)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This only replaces the timezone without actually computing the difference, right?

So if I e.g. submit a datetime.now() to this method, I would only get runs from two hours in the future (I'm on Central European Summer Time).

image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, I refactored it to use astimezone

@danpoletaev danpoletaev requested a review from barjin October 9, 2025 11:34
Copy link
Contributor

@vdusek vdusek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

offset=offset,
desc=desc,
status=status_param,
startedBefore=started_before,
Copy link
Contributor

@vdusek vdusek Oct 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do this for other parameters as well, so I believe it'll work 😄

(you can test it on a beta release, once this is merged)

Copy link
Contributor

@barjin barjin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm now, thank you @danpoletaev ! 🔥

@danpoletaev danpoletaev merged commit 3aaa056 into master Oct 10, 2025
24 checks passed
@danpoletaev danpoletaev deleted the feat/add-started-date-options-to-runs branch October 10, 2025 08:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

adhoc Ad-hoc unplanned task added during the sprint. t-core-services Issues with this label are in the ownership of the core services team. tested Temporary label used only programatically for some analytics.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants